import store from '@/store'
const columnsConfig = ['selection','operation'
                      ,'sid'
                      ,'tradeCode'
                      ,'emsNo'
                      ,'businessType'
                      ,'declareType'
                      ,'status'
                      ,'note'
                      ,'insertTime'
                      ,'insertUser'
                      ,'apprDate'
                      ,'billListNo'
                      ,'headId'
                      ,'flag'
                      ,'timeStamp'
                      ,'updateTime'
]
const columns = {
  data() {
    return {
      totalColumns: [
        {
          type: 'selection',
          width: 60,
          align: 'center',
          key: 'selection',
        },
        {
          title: '操作',
          width: 120,
          align: 'center',
          render: (h,params) => {
            return h('div', [
              h('a', {
                props: {
                  type: 'primary',
                  size: 'small'
                },
                style: {
                  marginRight: '15px'
                },
                on: {
                  click: () => {
                    this.gridConfig.selectData = params.row
                    this.handleEdit()
                  }
                }
              }, '编辑'),
              //添加查看按钮
              h('a', {
                props: {
                  type: 'primary',
                },
                style: {},
                on: {
                  click: () => {
                    this.gridConfig.selectData = params.row
                    this.handleView()
                  },
                },
              }, '查看')
              ]);
          },
          key: 'operation'
        },
        {
          title: '审批标志 ',
          minWidth: 120,
          align: 'center',
          key: 'status',
          render: (h, params) => {
            if (store.state.flag=='1'){
              return h('a',{
                on:{
                  click:()=>{
                    this.headId=params.row.headId
                    this.LogDetailListShow()
                  }
                }
              },params.row.status)
            }else {
              return h('div',params.row.status)
            }
          }
        },
        {
          title: '备注',
          minWidth: 120,
          align: 'center',
          key: 'note',
        },
        {
          title: '插入时间',
          minWidth: 120,
          align: 'center',
          key: 'insertTime',
          render: (h, params) => {
            return h('span', params.row.insertTime ? params.row.insertTime.slice(0, 10) : params.row.insertTime)
          }
        },
        {
          title: '审核时间',
          minWidth: 120,
          align: 'center',
          key: 'apprDate',
          render: (h, params) => {
            return h('span', params.row.apprDate ? params.row.apprDate.slice(0, 10) : params.row.apprDate)
          }
        },
      ]
    }
  }
}
export {
  columns,
  columnsConfig
}
